package file;
/**
 *
 */

import java.io.*;

public class FileOutputS {
    public static void main(String[] args){
        File file=new File("e:\\xx.txt");
        InputStream is=System.in;
        System.out.println("请输入：");
        try {
            FileOutputStream fos=new FileOutputStream(file);
            int c=is.read();
            while (c!='#'){
                if (c==10) fos.write(13);
                fos.write(c);
                c=is.read();
            }
            fos.close();
            System.out.println("已保存到文件");
            /*FileInputS fis=new FileInputS(file);
            int x=fis.read();
            while (x!=-1){
                System.out.println(x+",");
                x=fis.read();
            }
            fis.close();*/
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e){
            e.printStackTrace();
        }
    }
}
